package com.dayang.redbook.oss.biz.service.impl;

import com.dayang.framework.common.domain.response.Response;
import com.dayang.redbook.oss.biz.service.FileService;
import com.dayang.redbook.oss.biz.strategy.FileStrategy;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author: dayang
 * @since: 2024/6/28
 * @description:
 */
@Service
public class FileServiceImpl implements FileService {
    @Resource
    private FileStrategy fileStrategy;
    private static final String BUCKET_NAME = "redbook";
    @Override
    public Response<?> uploadFile(MultipartFile file) {
        // 上传文件
        String url = fileStrategy.uploadFile(file, BUCKET_NAME);
        return Response.success(url);
    }
}
